package com.yougou.ui.order;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;

import com.yougou.base.BaseViewModel;
import com.yougou.data.model.Order;
import com.yougou.utils.OrderManager;

import java.util.ArrayList;
import java.util.List;

public class OrderViewModel extends BaseViewModel {
    
    private MutableLiveData<List<Order>> orderList = new MutableLiveData<>();
    private MutableLiveData<String> error = new MutableLiveData<>();
    
    public LiveData<List<Order>> getOrderList() {
        return orderList;
    }
    
    public LiveData<String> getError() {
        return error;
    }
    
    
    public void loadOrders(int type) {
        // 从本地获取订单列表
        List<Order> orders = OrderManager.getOrdersByStatus(type);
        orderList.setValue(orders);
    }
}

